<template>
    <div class="Layout">
        <div class="windmill">
            <!-- 用来做透视的块 -->
            <div class="windmill-layout">
                <!-- 用来旋转的块 -->
                <div class="windmill-transform">
                    <!-- 色块 -->
                    <div class="windmill-blade red"></div>
                    <div class="windmill-blade blue"></div>
                    <div class="windmill-blade green"></div>
                    <div class="windmill-blade orange"></div>
                    <!-- 棍子 -->
                    <div class="windmill-stick x"></div>
                    <div class="windmill-stick y"></div>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>

</script>
<style lang="less" scoped>
.Layout {
    width: 300px;
    height: 300px;
    background-image: url(@/assets/starspace.png);
    position: relative;
}


.windmill {
    width: 100px;
    height: 100px;
    position: absolute;
    bottom: 30px;
    left: 30%;

    &-layout {
        width: 100px;
        height: 100px;
        position: absolute;
        perspective: 800px;
        transform-style: preserve-3d;
        transform: rotateX(70deg);
    }

    &-transform {
        width: 100px;
        height: 100px;
        animation: rotate linear infinite 10s;
        transform: rotateZ(45deg);
        transform-style: preserve-3d;
    }

    &-stick {
        width: 4px;
        height: 70px;
        position: absolute;
        left: 48px;
        top: 15px;
        background-color: rgb(0, 0, 0);

        &.x {
            transform: translateZ(-20px) rotateX(90deg) rotateY(45deg);
        }

        &.y {
            transform: translateZ(-20px) rotateX(90deg) rotateY(-45deg);
        }
    }

    &-blade {
        width: 50px;
        height: 30px;
        position: absolute;
        opacity: 0.5;

        &.blue {
            background-color: blue;
            transform: rotateX(90deg);
            top: 35px;
        }

        &.orange {
            background-color: orange;
            transform: rotateZ(90deg) rotateX(90deg);
            left: 25px;
            top: 60px;
        }

        &.red {
            background-color: red;
            transform: rotateX(90deg);
            left: 50px;
            top: 35px;
        }

        &.green {
            background-color: green;
            transform: rotateZ(90deg) rotateX(90deg);
            left: 25px;
            top: 10px;
        }
    }
}

@keyframes rotate {
    from {
        transform: rotateZ(0deg);
    }

    to {
        transform: rotateZ(360deg);
    }
}
</style>